# Copyright 2024 NXP
# NXP Confidential and Proprietary. This software is owned or controlled by NXP and may only be used strictly in
# accordance with the applicable license terms. By expressly accepting such terms or by downloading, installing,
# activating and/or otherwise using the software, you are agreeing that you have read, and that you agree to
# comply with and are bound by, such license terms.  If you do not agree to be bound by the applicable license
# terms, then you may not retain, install, activate or otherwise use the software.

import SDL
import utime as time
import usys as sys
import lvgl as lv
import lodepng as png
import ustruct
import fs_driver

lv.init()
SDL.init(w=480,h=320)

# Register SDL display driver.
disp_buf1 = lv.disp_draw_buf_t()
buf1_1 = bytearray(480*10)
disp_buf1.init(buf1_1, None, len(buf1_1)//4)
disp_drv = lv.disp_drv_t()
disp_drv.init()
disp_drv.draw_buf = disp_buf1
disp_drv.flush_cb = SDL.monitor_flush
disp_drv.hor_res = 480
disp_drv.ver_res = 320
disp_drv.register()

# Regsiter SDL mouse driver
indev_drv = lv.indev_drv_t()
indev_drv.init()
indev_drv.type = lv.INDEV_TYPE.POINTER
indev_drv.read_cb = SDL.mouse_read
indev_drv.register()

fs_drv = lv.fs_drv_t()
fs_driver.fs_register(fs_drv, 'Z')

# Below: Taken from https://github.com/lvgl/lv_binding_micropython/blob/master/driver/js/imagetools.py#L22-L94

COLOR_SIZE = lv.color_t.__SIZE__
COLOR_IS_SWAPPED = hasattr(lv.color_t().ch,'green_h')

class lodepng_error(RuntimeError):
    def __init__(self, err):
        if type(err) is int:
            super().__init__(png.error_text(err))
        else:
            super().__init__(err)

# Parse PNG file header
# Taken from https://github.com/shibukawa/imagesize_py/blob/ffef30c1a4715c5acf90e8945ceb77f4a2ed2d45/imagesize.py#L63-L85

def get_png_info(decoder, src, header):
    # Only handle variable image types

    if lv.img.src_get_type(src) != lv.img.SRC.VARIABLE:
        return lv.RES.INV

    data = lv.img_dsc_t.__cast__(src).data
    if data == None:
        return lv.RES.INV

    png_header = bytes(data.__dereference__(24))

    if png_header.startswith(b'\211PNG\r\n\032\n'):
        if png_header[12:16] == b'IHDR':
            start = 16
        # Maybe this is for an older PNG version.
        else:
            start = 8
        try:
            width, height = ustruct.unpack(">LL", png_header[start:start+8])
        except ustruct.error:
            return lv.RES.INV
    else:
        return lv.RES.INV

    header.always_zero = 0
    header.w = width
    header.h = height
    header.cf = lv.img.CF.TRUE_COLOR_ALPHA

    return lv.RES.OK

def convert_rgba8888_to_bgra8888(img_view):
    for i in range(0, len(img_view), lv.color_t.__SIZE__):
        ch = lv.color_t.__cast__(img_view[i:i]).ch
        ch.red, ch.blue = ch.blue, ch.red

# Read and parse PNG file

def open_png(decoder, dsc):
    img_dsc = lv.img_dsc_t.__cast__(dsc.src)
    png_data = img_dsc.data
    png_size = img_dsc.data_size
    png_decoded = png.C_Pointer()
    png_width = png.C_Pointer()
    png_height = png.C_Pointer()
    error = png.decode32(png_decoded, png_width, png_height, png_data, png_size)
    if error:
        raise lodepng_error(error)
    img_size = png_width.int_val * png_height.int_val * 4
    img_data = png_decoded.ptr_val
    img_view = img_data.__dereference__(img_size)

    if COLOR_SIZE == 4:
        convert_rgba8888_to_bgra8888(img_view)
    else:
        raise lodepng_error("Error: Color mode not supported yet!")

    dsc.img_data = img_data
    return lv.RES.OK

# Above: Taken from https://github.com/lvgl/lv_binding_micropython/blob/master/driver/js/imagetools.py#L22-L94

decoder = lv.img.decoder_create()
decoder.info_cb = get_png_info
decoder.open_cb = open_png

def anim_x_cb(obj, v):
    obj.set_x(v)

def anim_y_cb(obj, v):
    obj.set_y(v)

def anim_width_cb(obj, v):
    obj.set_width(v)

def anim_height_cb(obj, v):
    obj.set_height(v)

def anim_img_zoom_cb(obj, v):
    obj.set_zoom(v)

def anim_img_rotate_cb(obj, v):
    obj.set_angle(v)

global_font_cache = {}
def test_font(font_family, font_size):
    global global_font_cache
    if font_family + str(font_size) in global_font_cache:
        return global_font_cache[font_family + str(font_size)]
    if font_size % 2:
        candidates = [
            (font_family, font_size),
            (font_family, font_size-font_size%2),
            (font_family, font_size+font_size%2),
            ("montserrat", font_size-font_size%2),
            ("montserrat", font_size+font_size%2),
            ("montserrat", 16)
        ]
    else:
        candidates = [
            (font_family, font_size),
            ("montserrat", font_size),
            ("montserrat", 16)
        ]
    for (family, size) in candidates:
        try:
            if eval(f'lv.font_{family}_{size}'):
                global_font_cache[font_family + str(font_size)] = eval(f'lv.font_{family}_{size}')
                if family != font_family or size != font_size:
                    print(f'WARNING: lv.font_{family}_{size} is used!')
                return eval(f'lv.font_{family}_{size}')
        except AttributeError:
            try:
                load_font = lv.font_load(f"Z:MicroPython/lv_font_{family}_{size}.fnt")
                global_font_cache[font_family + str(font_size)] = load_font
                return load_font
            except:
                if family == font_family and size == font_size:
                    print(f'WARNING: lv.font_{family}_{size} is NOT supported!')

global_image_cache = {}
def load_image(file):
    global global_image_cache
    if file in global_image_cache:
        return global_image_cache[file]
    try:
        with open(file,'rb') as f:
            data = f.read()
    except:
        print(f'Could not open {file}')
        sys.exit()

    img = lv.img_dsc_t({
        'data_size': len(data),
        'data': data
    })
    global_image_cache[file] = img
    return img

def calendar_event_handler(e,obj):
    code = e.get_code()

    if code == lv.EVENT.VALUE_CHANGED:
        source = e.get_current_target()
        date = lv.calendar_date_t()
        if source.get_pressed_date(date) == lv.RES.OK:
            source.set_highlighted_dates([date], 1)

def spinbox_increment_event_cb(e, obj):
    code = e.get_code()
    if code == lv.EVENT.SHORT_CLICKED or code == lv.EVENT.LONG_PRESSED_REPEAT:
        obj.increment()
def spinbox_decrement_event_cb(e, obj):
    code = e.get_code()
    if code == lv.EVENT.SHORT_CLICKED or code == lv.EVENT.LONG_PRESSED_REPEAT:
        obj.decrement()

def digital_clock_cb(timer, obj, current_time, show_second, use_ampm):
    hour = int(current_time[0])
    minute = int(current_time[1])
    second = int(current_time[2])
    ampm = current_time[3]
    second = second + 1
    if second == 60:
        second = 0
        minute = minute + 1
        if minute == 60:
            minute = 0
            hour = hour + 1
            if use_ampm:
                if hour == 12:
                    if ampm == 'AM':
                        ampm = 'PM'
                    elif ampm == 'PM':
                        ampm = 'AM'
                if hour > 12:
                    hour = hour % 12
    hour = hour % 24
    if use_ampm:
        if show_second:
            obj.set_text("%02d:%02d:%02d %s" %(hour, minute, second, ampm))
        else:
            obj.set_text("%02d:%02d %s" %(hour, minute, ampm))
    else:
        if show_second:
            obj.set_text("%02d:%02d:%02d" %(hour, minute, second))
        else:
            obj.set_text("%02d:%02d" %(hour, minute))
    current_time[0] = hour
    current_time[1] = minute
    current_time[2] = second
    current_time[3] = ampm

def analog_clock_cb(timer, obj):
    datetime = time.localtime()
    hour = datetime[3]
    if hour >= 12: hour = hour - 12
    obj.set_time(hour, datetime[4], datetime[5])

def datetext_event_handler(e, obj):
    code = e.get_code()
    target = e.get_target()
    if code == lv.EVENT.FOCUSED:
        if obj is None:
            bg = lv.layer_top()
            bg.add_flag(lv.obj.FLAG.CLICKABLE)
            obj = lv.calendar(bg)
            scr = target.get_screen()
            scr_height = scr.get_height()
            scr_width = scr.get_width()
            obj.set_size(int(scr_width * 0.8), int(scr_height * 0.8))
            datestring = target.get_text()
            year = int(datestring.split('/')[0])
            month = int(datestring.split('/')[1])
            day = int(datestring.split('/')[2])
            obj.set_showed_date(year, month)
            highlighted_days=[lv.calendar_date_t({'year':year, 'month':month, 'day':day})]
            obj.set_highlighted_dates(highlighted_days, 1)
            obj.align(lv.ALIGN.CENTER, 0, 0)
            lv.calendar_header_arrow(obj)
            obj.add_event_cb(lambda e: datetext_calendar_event_handler(e, target), lv.EVENT.ALL, None)
            scr.update_layout()

def datetext_calendar_event_handler(e, obj):
    code = e.get_code()
    target = e.get_current_target()
    if code == lv.EVENT.VALUE_CHANGED:
        date = lv.calendar_date_t()
        if target.get_pressed_date(date) == lv.RES.OK:
            obj.set_text(f"{date.year}/{date.month}/{date.day}")
            bg = lv.layer_top()
            bg.clear_flag(lv.obj.FLAG.CLICKABLE)
            bg.set_style_bg_opa(lv.OPA.TRANSP, 0)
            target.delete()

def screen_content_ta_event_cb(e,kb):
    code = e.get_code()
    ta = e.get_target()
    if code == lv.EVENT.FOCUSED:
        kb.set_textarea(ta)
        kb.move_foreground()
        kb.clear_flag(lv.obj.FLAG.HIDDEN)

    if code == lv.EVENT.DEFOCUSED:
        kb.set_textarea(None)
        kb.move_background()
        kb.add_flag(lv.obj.FLAG.HIDDEN)

def screen_panel_ta_event_cb(e,kb):
    code = e.get_code()
    ta = e.get_target()
    if code == lv.EVENT.FOCUSED:
        kb.set_textarea(ta)
        kb.move_foreground()
        kb.clear_flag(lv.obj.FLAG.HIDDEN)

    if code == lv.EVENT.DEFOCUSED:
        kb.set_textarea(None)
        kb.move_background()
        kb.add_flag(lv.obj.FLAG.HIDDEN)

def screen_widget_ta_event_cb(e,kb):
    code = e.get_code()
    ta = e.get_target()
    if code == lv.EVENT.FOCUSED:
        kb.set_textarea(ta)
        kb.move_foreground()
        kb.clear_flag(lv.obj.FLAG.HIDDEN)

    if code == lv.EVENT.DEFOCUSED:
        kb.set_textarea(None)
        kb.move_background()
        kb.add_flag(lv.obj.FLAG.HIDDEN)

def screen_pinyin_ta_event_cb(e,kb):
    code = e.get_code()
    ta = e.get_target()
    if code == lv.EVENT.FOCUSED:
        kb.set_textarea(ta)
        kb.move_foreground()
        kb.clear_flag(lv.obj.FLAG.HIDDEN)

    if code == lv.EVENT.DEFOCUSED:
        kb.set_textarea(None)
        kb.move_background()
        kb.add_flag(lv.obj.FLAG.HIDDEN)

def screen_background_ta_event_cb(e,kb):
    code = e.get_code()
    ta = e.get_target()
    if code == lv.EVENT.FOCUSED:
        kb.set_textarea(ta)
        kb.move_foreground()
        kb.clear_flag(lv.obj.FLAG.HIDDEN)

    if code == lv.EVENT.DEFOCUSED:
        kb.set_textarea(None)
        kb.move_background()
        kb.add_flag(lv.obj.FLAG.HIDDEN)

# Create screen_content
screen_content = lv.obj()
screen_content.set_size(480, 320)
screen_content.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
# Set style for screen_content, Part: lv.PART.MAIN, State: lv.STATE.DEFAULT.
screen_content.set_style_bg_opa(255, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_content.set_style_bg_color(lv.color_hex(0x000000), lv.PART.MAIN|lv.STATE.DEFAULT)

# Create screen_content_img_1
screen_content_img_1 = lv.img(screen_content)
screen_content_img_1.set_src(load_image(r"C:\NXP\GUI-Guider-Projects\CCM4101_GUI_160_1V0.2\CCM4101_GUI_160_1\CCM4101_GUI_160_1\generated\MicroPython\6_1_480_320.png"))
screen_content_img_1.add_flag(lv.obj.FLAG.CLICKABLE)
screen_content_img_1.set_pivot(50,50)
screen_content_img_1.set_angle(0)
screen_content_img_1.set_pos(0, 0)
screen_content_img_1.set_size(480, 320)
screen_content_img_1.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
# Set style for screen_content_img_1, Part: lv.PART.MAIN, State: lv.STATE.DEFAULT.
screen_content_img_1.set_style_img_opa(255, lv.PART.MAIN|lv.STATE.DEFAULT)

# Create screen_content_btn_background
screen_content_btn_background = lv.btn(screen_content)
screen_content_btn_background_label = lv.label(screen_content_btn_background)
screen_content_btn_background_label.set_text("")
screen_content_btn_background_label.set_long_mode(lv.label.LONG.WRAP)
screen_content_btn_background_label.align(lv.ALIGN.CENTER, 0, 0)
screen_content_btn_background.set_style_pad_all(0, lv.STATE.DEFAULT)
screen_content_btn_background.set_pos(279, 173)
screen_content_btn_background.set_size(95, 96)
screen_content_btn_background.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
# Set style for screen_content_btn_background, Part: lv.PART.MAIN, State: lv.STATE.DEFAULT.
screen_content_btn_background.set_style_bg_opa(0, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_content_btn_background.set_style_border_width(0, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_content_btn_background.set_style_radius(5, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_content_btn_background.set_style_shadow_width(0, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_content_btn_background.set_style_text_color(lv.color_hex(0xffffff), lv.PART.MAIN|lv.STATE.DEFAULT)
screen_content_btn_background.set_style_text_font(test_font("simsun", 20), lv.PART.MAIN|lv.STATE.DEFAULT)
screen_content_btn_background.set_style_text_align(lv.TEXT_ALIGN.CENTER, lv.PART.MAIN|lv.STATE.DEFAULT)

# Create screen_content_btn_panel
screen_content_btn_panel = lv.btn(screen_content)
screen_content_btn_panel_label = lv.label(screen_content_btn_panel)
screen_content_btn_panel_label.set_text("")
screen_content_btn_panel_label.set_long_mode(lv.label.LONG.WRAP)
screen_content_btn_panel_label.align(lv.ALIGN.CENTER, 0, 0)
screen_content_btn_panel.set_style_pad_all(0, lv.STATE.DEFAULT)
screen_content_btn_panel.set_pos(104, 28)
screen_content_btn_panel.set_size(94, 93)
screen_content_btn_panel.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
# Set style for screen_content_btn_panel, Part: lv.PART.MAIN, State: lv.STATE.DEFAULT.
screen_content_btn_panel.set_style_bg_opa(0, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_content_btn_panel.set_style_border_width(0, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_content_btn_panel.set_style_radius(5, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_content_btn_panel.set_style_shadow_width(0, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_content_btn_panel.set_style_text_color(lv.color_hex(0xffffff), lv.PART.MAIN|lv.STATE.DEFAULT)
screen_content_btn_panel.set_style_text_font(test_font("simsun", 20), lv.PART.MAIN|lv.STATE.DEFAULT)
screen_content_btn_panel.set_style_text_align(lv.TEXT_ALIGN.CENTER, lv.PART.MAIN|lv.STATE.DEFAULT)

# Create screen_content_btn_pinyin
screen_content_btn_pinyin = lv.btn(screen_content)
screen_content_btn_pinyin_label = lv.label(screen_content_btn_pinyin)
screen_content_btn_pinyin_label.set_text("")
screen_content_btn_pinyin_label.set_long_mode(lv.label.LONG.WRAP)
screen_content_btn_pinyin_label.align(lv.ALIGN.CENTER, 0, 0)
screen_content_btn_pinyin.set_style_pad_all(0, lv.STATE.DEFAULT)
screen_content_btn_pinyin.set_pos(104, 173)
screen_content_btn_pinyin.set_size(96, 96)
screen_content_btn_pinyin.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
# Set style for screen_content_btn_pinyin, Part: lv.PART.MAIN, State: lv.STATE.DEFAULT.
screen_content_btn_pinyin.set_style_bg_opa(0, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_content_btn_pinyin.set_style_border_width(0, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_content_btn_pinyin.set_style_radius(5, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_content_btn_pinyin.set_style_shadow_width(0, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_content_btn_pinyin.set_style_text_color(lv.color_hex(0xffffff), lv.PART.MAIN|lv.STATE.DEFAULT)
screen_content_btn_pinyin.set_style_text_font(test_font("simsun", 20), lv.PART.MAIN|lv.STATE.DEFAULT)
screen_content_btn_pinyin.set_style_text_align(lv.TEXT_ALIGN.CENTER, lv.PART.MAIN|lv.STATE.DEFAULT)

# Create screen_content_btn_widget
screen_content_btn_widget = lv.btn(screen_content)
screen_content_btn_widget_label = lv.label(screen_content_btn_widget)
screen_content_btn_widget_label.set_text("")
screen_content_btn_widget_label.set_long_mode(lv.label.LONG.WRAP)
screen_content_btn_widget_label.align(lv.ALIGN.CENTER, 0, 0)
screen_content_btn_widget.set_style_pad_all(0, lv.STATE.DEFAULT)
screen_content_btn_widget.set_pos(280, 27)
screen_content_btn_widget.set_size(94, 96)
screen_content_btn_widget.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
# Set style for screen_content_btn_widget, Part: lv.PART.MAIN, State: lv.STATE.DEFAULT.
screen_content_btn_widget.set_style_bg_opa(0, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_content_btn_widget.set_style_border_width(0, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_content_btn_widget.set_style_radius(5, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_content_btn_widget.set_style_shadow_width(0, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_content_btn_widget.set_style_text_color(lv.color_hex(0xffffff), lv.PART.MAIN|lv.STATE.DEFAULT)
screen_content_btn_widget.set_style_text_font(test_font("simsun", 20), lv.PART.MAIN|lv.STATE.DEFAULT)
screen_content_btn_widget.set_style_text_align(lv.TEXT_ALIGN.CENTER, lv.PART.MAIN|lv.STATE.DEFAULT)

screen_content.update_layout()
# Create screen_panel
screen_panel = lv.obj()
screen_panel.set_size(480, 320)
screen_panel.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
# Set style for screen_panel, Part: lv.PART.MAIN, State: lv.STATE.DEFAULT.
screen_panel.set_style_bg_opa(0, lv.PART.MAIN|lv.STATE.DEFAULT)

# Create screen_panel_img_panel
screen_panel_img_panel = lv.img(screen_panel)
screen_panel_img_panel.set_src(load_image(r"C:\NXP\GUI-Guider-Projects\CCM4101_GUI_160_1V0.2\CCM4101_GUI_160_1\CCM4101_GUI_160_1\generated\MicroPython\0_3_480_320.png"))
screen_panel_img_panel.add_flag(lv.obj.FLAG.CLICKABLE)
screen_panel_img_panel.set_pivot(50,50)
screen_panel_img_panel.set_angle(0)
screen_panel_img_panel.set_pos(0, 0)
screen_panel_img_panel.set_size(480, 320)
screen_panel_img_panel.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
# Set style for screen_panel_img_panel, Part: lv.PART.MAIN, State: lv.STATE.DEFAULT.
screen_panel_img_panel.set_style_img_opa(255, lv.PART.MAIN|lv.STATE.DEFAULT)

# Create screen_panel_meter_panel
screen_panel_meter_panel = lv.meter(screen_panel)
#add scale screen_panel_meter_panel_scale_1
screen_panel_meter_panel_scale_1 = screen_panel_meter_panel.add_scale()
screen_panel_meter_panel.set_scale_ticks(screen_panel_meter_panel_scale_1, 41, 1, 1, lv.color_hex(0x000000))
screen_panel_meter_panel.set_scale_range(screen_panel_meter_panel_scale_1, 0, 360, 300, 90)
# add needle line for screen_panel_meter_panel_scale_1
screen_panel_meter_panel_scale_1_needleLine_0 = screen_panel_meter_panel.add_needle_line(screen_panel_meter_panel_scale_1, 2, lv.color_hex(0xffffff), -10)
screen_panel_meter_panel.set_indicator_value( screen_panel_meter_panel_scale_1_needleLine_0, 72)
screen_panel_meter_panel.set_pos(140, 60)
screen_panel_meter_panel.set_size(200, 200)
screen_panel_meter_panel.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
# Set style for screen_panel_meter_panel, Part: lv.PART.MAIN, State: lv.STATE.DEFAULT.
screen_panel_meter_panel.set_style_bg_opa(0, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_panel_meter_panel.set_style_radius(200, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_panel_meter_panel.set_style_border_width(0, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_panel_meter_panel.set_style_shadow_width(0, lv.PART.MAIN|lv.STATE.DEFAULT)

# Set style for screen_panel_meter_panel, Part: lv.PART.TICKS, State: lv.STATE.DEFAULT.
screen_panel_meter_panel.set_style_text_color(lv.color_hex(0xff0000), lv.PART.TICKS|lv.STATE.DEFAULT)
screen_panel_meter_panel.set_style_text_font(test_font("montserratMedium", 12), lv.PART.TICKS|lv.STATE.DEFAULT)

screen_panel.update_layout()
# Create screen_widget
screen_widget = lv.obj()
screen_widget.set_size(480, 320)
screen_widget.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
# Set style for screen_widget, Part: lv.PART.MAIN, State: lv.STATE.DEFAULT.
screen_widget.set_style_bg_opa(255, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget.set_style_bg_color(lv.color_hex(0x000000), lv.PART.MAIN|lv.STATE.DEFAULT)

# Create screen_widget_img_1
screen_widget_img_1 = lv.img(screen_widget)
screen_widget_img_1.set_src(load_image(r"C:\NXP\GUI-Guider-Projects\CCM4101_GUI_160_1V0.2\CCM4101_GUI_160_1\CCM4101_GUI_160_1\generated\MicroPython\5_1_62_61.png"))
screen_widget_img_1.add_flag(lv.obj.FLAG.CLICKABLE)
screen_widget_img_1.set_pivot(50,50)
screen_widget_img_1.set_angle(0)
screen_widget_img_1.set_pos(5, 3)
screen_widget_img_1.set_size(62, 61)
screen_widget_img_1.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
# Set style for screen_widget_img_1, Part: lv.PART.MAIN, State: lv.STATE.DEFAULT.
screen_widget_img_1.set_style_img_opa(255, lv.PART.MAIN|lv.STATE.DEFAULT)

# Create screen_widget_btn_on
screen_widget_btn_on = lv.btn(screen_widget)
screen_widget_btn_on_label = lv.label(screen_widget_btn_on)
screen_widget_btn_on_label.set_text("ON")
screen_widget_btn_on_label.set_long_mode(lv.label.LONG.WRAP)
screen_widget_btn_on_label.align(lv.ALIGN.CENTER, 0, 0)
screen_widget_btn_on.set_style_pad_all(0, lv.STATE.DEFAULT)
screen_widget_btn_on.set_pos(80, 64)
screen_widget_btn_on.set_size(50, 50)
screen_widget_btn_on.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
# Set style for screen_widget_btn_on, Part: lv.PART.MAIN, State: lv.STATE.DEFAULT.
screen_widget_btn_on.set_style_bg_opa(255, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_btn_on.set_style_bg_color(lv.color_hex(0x2195f6), lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_btn_on.set_style_border_width(0, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_btn_on.set_style_radius(5, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_btn_on.set_style_shadow_width(0, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_btn_on.set_style_text_color(lv.color_hex(0xffffff), lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_btn_on.set_style_text_font(test_font("montserratMedium", 16), lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_btn_on.set_style_text_align(lv.TEXT_ALIGN.CENTER, lv.PART.MAIN|lv.STATE.DEFAULT)

# Create screen_widget_btn_off
screen_widget_btn_off = lv.btn(screen_widget)
screen_widget_btn_off_label = lv.label(screen_widget_btn_off)
screen_widget_btn_off_label.set_text("OFF")
screen_widget_btn_off_label.set_long_mode(lv.label.LONG.WRAP)
screen_widget_btn_off_label.align(lv.ALIGN.CENTER, 0, 0)
screen_widget_btn_off.set_style_pad_all(0, lv.STATE.DEFAULT)
screen_widget_btn_off.set_pos(160, 64)
screen_widget_btn_off.set_size(50, 50)
screen_widget_btn_off.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
# Set style for screen_widget_btn_off, Part: lv.PART.MAIN, State: lv.STATE.DEFAULT.
screen_widget_btn_off.set_style_bg_opa(255, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_btn_off.set_style_bg_color(lv.color_hex(0x2195f6), lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_btn_off.set_style_border_width(0, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_btn_off.set_style_radius(5, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_btn_off.set_style_shadow_width(0, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_btn_off.set_style_text_color(lv.color_hex(0xffffff), lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_btn_off.set_style_text_font(test_font("montserratMedium", 16), lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_btn_off.set_style_text_align(lv.TEXT_ALIGN.CENTER, lv.PART.MAIN|lv.STATE.DEFAULT)

# Create screen_widget_label_switch
screen_widget_label_switch = lv.label(screen_widget)
screen_widget_label_switch.set_text("开关")
screen_widget_label_switch.set_long_mode(lv.label.LONG.WRAP)
screen_widget_label_switch.set_pos(1, 80)
screen_widget_label_switch.set_size(70, 20)
screen_widget_label_switch.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
# Set style for screen_widget_label_switch, Part: lv.PART.MAIN, State: lv.STATE.DEFAULT.
screen_widget_label_switch.set_style_border_width(0, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_label_switch.set_style_radius(0, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_label_switch.set_style_text_color(lv.color_hex(0xffffff), lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_label_switch.set_style_text_font(test_font("simsun", 16), lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_label_switch.set_style_text_letter_space(2, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_label_switch.set_style_text_line_space(0, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_label_switch.set_style_text_align(lv.TEXT_ALIGN.CENTER, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_label_switch.set_style_bg_opa(0, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_label_switch.set_style_pad_top(0, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_label_switch.set_style_pad_right(0, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_label_switch.set_style_pad_bottom(0, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_label_switch.set_style_pad_left(0, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_label_switch.set_style_shadow_width(0, lv.PART.MAIN|lv.STATE.DEFAULT)

# Create screen_widget_bar_progress
screen_widget_bar_progress = lv.bar(screen_widget)
screen_widget_bar_progress.set_style_anim_time(1000, 0)
screen_widget_bar_progress.set_mode(lv.bar.MODE.SYMMETRICAL)
screen_widget_bar_progress.set_value(100, lv.ANIM.ON)
screen_widget_bar_progress.set_pos(78, 204)
screen_widget_bar_progress.set_size(158, 22)
screen_widget_bar_progress.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
# Set style for screen_widget_bar_progress, Part: lv.PART.MAIN, State: lv.STATE.DEFAULT.
screen_widget_bar_progress.set_style_bg_opa(60, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_bar_progress.set_style_bg_color(lv.color_hex(0x2195f6), lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_bar_progress.set_style_radius(10, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_bar_progress.set_style_shadow_width(0, lv.PART.MAIN|lv.STATE.DEFAULT)
# Set style for screen_widget_bar_progress, Part: lv.PART.INDICATOR, State: lv.STATE.DEFAULT.
screen_widget_bar_progress.set_style_bg_opa(255, lv.PART.INDICATOR|lv.STATE.DEFAULT)
screen_widget_bar_progress.set_style_bg_color(lv.color_hex(0x2195f6), lv.PART.INDICATOR|lv.STATE.DEFAULT)
screen_widget_bar_progress.set_style_radius(10, lv.PART.INDICATOR|lv.STATE.DEFAULT)

# Create screen_widget_slider_show
screen_widget_slider_show = lv.slider(screen_widget)
screen_widget_slider_show.set_range(0,1000)
screen_widget_slider_show.set_value(200, False)
screen_widget_slider_show.set_pos(78, 149)
screen_widget_slider_show.set_size(155, 22)
screen_widget_slider_show.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
# Set style for screen_widget_slider_show, Part: lv.PART.MAIN, State: lv.STATE.DEFAULT.
screen_widget_slider_show.set_style_bg_opa(60, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_slider_show.set_style_bg_color(lv.color_hex(0x2195f6), lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_slider_show.set_style_radius(50, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_slider_show.set_style_outline_width(0, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_slider_show.set_style_shadow_width(0, lv.PART.MAIN|lv.STATE.DEFAULT)

# Set style for screen_widget_slider_show, Part: lv.PART.INDICATOR, State: lv.STATE.DEFAULT.
screen_widget_slider_show.set_style_bg_opa(255, lv.PART.INDICATOR|lv.STATE.DEFAULT)
screen_widget_slider_show.set_style_bg_color(lv.color_hex(0x2195f6), lv.PART.INDICATOR|lv.STATE.DEFAULT)
screen_widget_slider_show.set_style_radius(50, lv.PART.INDICATOR|lv.STATE.DEFAULT)

# Set style for screen_widget_slider_show, Part: lv.PART.KNOB, State: lv.STATE.DEFAULT.
screen_widget_slider_show.set_style_bg_opa(255, lv.PART.KNOB|lv.STATE.DEFAULT)
screen_widget_slider_show.set_style_bg_color(lv.color_hex(0x2195f6), lv.PART.KNOB|lv.STATE.DEFAULT)
screen_widget_slider_show.set_style_radius(50, lv.PART.KNOB|lv.STATE.DEFAULT)

# Create screen_widget_ddlist_show
screen_widget_ddlist_show = lv.dropdown(screen_widget)
screen_widget_ddlist_show.set_options("list1\nlist2\nlist3")
screen_widget_ddlist_show.set_pos(78, 256)
screen_widget_ddlist_show.set_size(156, 29)
screen_widget_ddlist_show.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
# Set style for screen_widget_ddlist_show, Part: lv.PART.MAIN, State: lv.STATE.DEFAULT.
screen_widget_ddlist_show.set_style_text_color(lv.color_hex(0x0D3055), lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_ddlist_show.set_style_text_font(test_font("montserratMedium", 12), lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_ddlist_show.set_style_border_width(1, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_ddlist_show.set_style_border_opa(255, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_ddlist_show.set_style_border_color(lv.color_hex(0xe1e6ee), lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_ddlist_show.set_style_pad_top(8, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_ddlist_show.set_style_pad_left(6, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_ddlist_show.set_style_pad_right(6, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_ddlist_show.set_style_radius(3, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_ddlist_show.set_style_bg_opa(255, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_ddlist_show.set_style_bg_color(lv.color_hex(0xffffff), lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_ddlist_show.set_style_shadow_width(0, lv.PART.MAIN|lv.STATE.DEFAULT)

# Set style for screen_widget_ddlist_show, Part: lv.PART.SELECTED, State: lv.STATE.CHECKED.
style_screen_widget_ddlist_show_extra_list_selected_checked = lv.style_t()
style_screen_widget_ddlist_show_extra_list_selected_checked.init()
style_screen_widget_ddlist_show_extra_list_selected_checked.set_text_color(lv.color_hex(0xffffff))
style_screen_widget_ddlist_show_extra_list_selected_checked.set_text_font(test_font("montserratMedium", 12))
style_screen_widget_ddlist_show_extra_list_selected_checked.set_border_width(1)
style_screen_widget_ddlist_show_extra_list_selected_checked.set_border_opa(255)
style_screen_widget_ddlist_show_extra_list_selected_checked.set_border_color(lv.color_hex(0xe1e6ee))
style_screen_widget_ddlist_show_extra_list_selected_checked.set_radius(3)
style_screen_widget_ddlist_show_extra_list_selected_checked.set_bg_opa(255)
style_screen_widget_ddlist_show_extra_list_selected_checked.set_bg_color(lv.color_hex(0x00a1b5))
screen_widget_ddlist_show.get_list().add_style(style_screen_widget_ddlist_show_extra_list_selected_checked, lv.PART.SELECTED|lv.STATE.CHECKED)
# Set style for screen_widget_ddlist_show, Part: lv.PART.MAIN, State: lv.STATE.DEFAULT.
style_screen_widget_ddlist_show_extra_list_main_default = lv.style_t()
style_screen_widget_ddlist_show_extra_list_main_default.init()
style_screen_widget_ddlist_show_extra_list_main_default.set_max_height(90)
style_screen_widget_ddlist_show_extra_list_main_default.set_text_color(lv.color_hex(0x0D3055))
style_screen_widget_ddlist_show_extra_list_main_default.set_text_font(test_font("montserratMedium", 12))
style_screen_widget_ddlist_show_extra_list_main_default.set_border_width(1)
style_screen_widget_ddlist_show_extra_list_main_default.set_border_opa(255)
style_screen_widget_ddlist_show_extra_list_main_default.set_border_color(lv.color_hex(0xe1e6ee))
style_screen_widget_ddlist_show_extra_list_main_default.set_radius(3)
style_screen_widget_ddlist_show_extra_list_main_default.set_bg_opa(255)
style_screen_widget_ddlist_show_extra_list_main_default.set_bg_color(lv.color_hex(0xffffff))
screen_widget_ddlist_show.get_list().add_style(style_screen_widget_ddlist_show_extra_list_main_default, lv.PART.MAIN|lv.STATE.DEFAULT)
# Set style for screen_widget_ddlist_show, Part: lv.PART.SCROLLBAR, State: lv.STATE.DEFAULT.
style_screen_widget_ddlist_show_extra_list_scrollbar_default = lv.style_t()
style_screen_widget_ddlist_show_extra_list_scrollbar_default.init()
style_screen_widget_ddlist_show_extra_list_scrollbar_default.set_radius(3)
style_screen_widget_ddlist_show_extra_list_scrollbar_default.set_bg_opa(255)
style_screen_widget_ddlist_show_extra_list_scrollbar_default.set_bg_color(lv.color_hex(0x00ff00))
screen_widget_ddlist_show.get_list().add_style(style_screen_widget_ddlist_show_extra_list_scrollbar_default, lv.PART.SCROLLBAR|lv.STATE.DEFAULT)

# Create screen_widget_digital_clock_time
screen_widget_digital_clock_time_time = [int(11), int(25), int(50), "AM"]
screen_widget_digital_clock_time = lv.dclock(screen_widget, "11:25:50 AM")
screen_widget_digital_clock_time_timer = lv.timer_create_basic()
screen_widget_digital_clock_time_timer.set_period(1000)
screen_widget_digital_clock_time_timer.set_cb(lambda src: digital_clock_cb(screen_widget_digital_clock_time_timer, screen_widget_digital_clock_time, screen_widget_digital_clock_time_time, True, True ))
screen_widget_digital_clock_time.set_pos(322, 53)
screen_widget_digital_clock_time.set_size(143, 30)
screen_widget_digital_clock_time.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
# Set style for screen_widget_digital_clock_time, Part: lv.PART.MAIN, State: lv.STATE.DEFAULT.
screen_widget_digital_clock_time.set_style_radius(0, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_digital_clock_time.set_style_text_color(lv.color_hex(0xffffff), lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_digital_clock_time.set_style_text_font(test_font("montserratMedium", 16), lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_digital_clock_time.set_style_text_letter_space(0, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_digital_clock_time.set_style_text_align(lv.TEXT_ALIGN.CENTER, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_digital_clock_time.set_style_bg_opa(255, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_digital_clock_time.set_style_bg_color(lv.color_hex(0x2195f6), lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_digital_clock_time.set_style_pad_top(7, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_digital_clock_time.set_style_pad_right(0, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_digital_clock_time.set_style_pad_bottom(0, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_digital_clock_time.set_style_pad_left(0, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_digital_clock_time.set_style_shadow_width(0, lv.PART.MAIN|lv.STATE.DEFAULT)

# Create screen_widget_qrcode_barcode
screen_widget_qrcode_barcode = lv.qrcode(screen_widget, 140, lv.color_hex(0x2C3224), lv.color_hex(0xffffff))
screen_widget_qrcode_barcode_data = "https://www.china-core.com/"
screen_widget_qrcode_barcode.update(screen_widget_qrcode_barcode_data, len(screen_widget_qrcode_barcode_data))
screen_widget_qrcode_barcode.set_pos(324, 162)
screen_widget_qrcode_barcode.set_size(140, 140)

# Create screen_widget_label_slider
screen_widget_label_slider = lv.label(screen_widget)
screen_widget_label_slider.set_text("滑动条")
screen_widget_label_slider.set_long_mode(lv.label.LONG.WRAP)
screen_widget_label_slider.set_pos(8, 150)
screen_widget_label_slider.set_size(70, 20)
screen_widget_label_slider.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
# Set style for screen_widget_label_slider, Part: lv.PART.MAIN, State: lv.STATE.DEFAULT.
screen_widget_label_slider.set_style_border_width(0, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_label_slider.set_style_radius(0, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_label_slider.set_style_text_color(lv.color_hex(0xffffff), lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_label_slider.set_style_text_font(test_font("simsun", 16), lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_label_slider.set_style_text_letter_space(2, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_label_slider.set_style_text_line_space(0, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_label_slider.set_style_text_align(lv.TEXT_ALIGN.CENTER, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_label_slider.set_style_bg_opa(0, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_label_slider.set_style_pad_top(0, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_label_slider.set_style_pad_right(0, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_label_slider.set_style_pad_bottom(0, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_label_slider.set_style_pad_left(0, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_label_slider.set_style_shadow_width(0, lv.PART.MAIN|lv.STATE.DEFAULT)

# Create screen_widget_label_progress
screen_widget_label_progress = lv.label(screen_widget)
screen_widget_label_progress.set_text("进度条")
screen_widget_label_progress.set_long_mode(lv.label.LONG.WRAP)
screen_widget_label_progress.set_pos(5, 205)
screen_widget_label_progress.set_size(70, 20)
screen_widget_label_progress.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
# Set style for screen_widget_label_progress, Part: lv.PART.MAIN, State: lv.STATE.DEFAULT.
screen_widget_label_progress.set_style_border_width(0, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_label_progress.set_style_radius(0, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_label_progress.set_style_text_color(lv.color_hex(0xffffff), lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_label_progress.set_style_text_font(test_font("simsun", 16), lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_label_progress.set_style_text_letter_space(2, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_label_progress.set_style_text_line_space(0, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_label_progress.set_style_text_align(lv.TEXT_ALIGN.CENTER, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_label_progress.set_style_bg_opa(0, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_label_progress.set_style_pad_top(0, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_label_progress.set_style_pad_right(0, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_label_progress.set_style_pad_bottom(0, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_label_progress.set_style_pad_left(0, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_label_progress.set_style_shadow_width(0, lv.PART.MAIN|lv.STATE.DEFAULT)

# Create screen_widget_label_ddlist
screen_widget_label_ddlist = lv.label(screen_widget)
screen_widget_label_ddlist.set_text("下拉框")
screen_widget_label_ddlist.set_long_mode(lv.label.LONG.WRAP)
screen_widget_label_ddlist.set_pos(5, 265)
screen_widget_label_ddlist.set_size(70, 20)
screen_widget_label_ddlist.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
# Set style for screen_widget_label_ddlist, Part: lv.PART.MAIN, State: lv.STATE.DEFAULT.
screen_widget_label_ddlist.set_style_border_width(0, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_label_ddlist.set_style_radius(0, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_label_ddlist.set_style_text_color(lv.color_hex(0xffffff), lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_label_ddlist.set_style_text_font(test_font("simsun", 16), lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_label_ddlist.set_style_text_letter_space(2, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_label_ddlist.set_style_text_line_space(0, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_label_ddlist.set_style_text_align(lv.TEXT_ALIGN.CENTER, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_label_ddlist.set_style_bg_opa(0, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_label_ddlist.set_style_pad_top(0, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_label_ddlist.set_style_pad_right(0, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_label_ddlist.set_style_pad_bottom(0, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_label_ddlist.set_style_pad_left(0, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_label_ddlist.set_style_shadow_width(0, lv.PART.MAIN|lv.STATE.DEFAULT)

# Create screen_widget_label_datetime
screen_widget_label_datetime = lv.label(screen_widget)
screen_widget_label_datetime.set_text("当前时间")
screen_widget_label_datetime.set_long_mode(lv.label.LONG.WRAP)
screen_widget_label_datetime.set_pos(234, 60)
screen_widget_label_datetime.set_size(80, 20)
screen_widget_label_datetime.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
# Set style for screen_widget_label_datetime, Part: lv.PART.MAIN, State: lv.STATE.DEFAULT.
screen_widget_label_datetime.set_style_border_width(0, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_label_datetime.set_style_radius(0, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_label_datetime.set_style_text_color(lv.color_hex(0xffffff), lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_label_datetime.set_style_text_font(test_font("simsun", 16), lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_label_datetime.set_style_text_letter_space(2, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_label_datetime.set_style_text_line_space(0, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_label_datetime.set_style_text_align(lv.TEXT_ALIGN.CENTER, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_label_datetime.set_style_bg_opa(0, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_label_datetime.set_style_pad_top(0, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_label_datetime.set_style_pad_right(0, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_label_datetime.set_style_pad_bottom(0, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_label_datetime.set_style_pad_left(0, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_label_datetime.set_style_shadow_width(0, lv.PART.MAIN|lv.STATE.DEFAULT)

# Create screen_widget_label_barcode
screen_widget_label_barcode = lv.label(screen_widget)
screen_widget_label_barcode.set_text("二维码")
screen_widget_label_barcode.set_long_mode(lv.label.LONG.WRAP)
screen_widget_label_barcode.set_pos(254, 216)
screen_widget_label_barcode.set_size(70, 20)
screen_widget_label_barcode.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
# Set style for screen_widget_label_barcode, Part: lv.PART.MAIN, State: lv.STATE.DEFAULT.
screen_widget_label_barcode.set_style_border_width(0, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_label_barcode.set_style_radius(0, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_label_barcode.set_style_text_color(lv.color_hex(0xffffff), lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_label_barcode.set_style_text_font(test_font("simsun", 16), lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_label_barcode.set_style_text_letter_space(2, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_label_barcode.set_style_text_line_space(0, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_label_barcode.set_style_text_align(lv.TEXT_ALIGN.CENTER, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_label_barcode.set_style_bg_opa(0, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_label_barcode.set_style_pad_top(0, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_label_barcode.set_style_pad_right(0, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_label_barcode.set_style_pad_bottom(0, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_label_barcode.set_style_pad_left(0, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_label_barcode.set_style_shadow_width(0, lv.PART.MAIN|lv.STATE.DEFAULT)

# Create screen_widget_label_textshow
screen_widget_label_textshow = lv.label(screen_widget)
screen_widget_label_textshow.set_text("https://www.china-core.com/")
screen_widget_label_textshow.set_long_mode(lv.label.LONG.SCROLL)
screen_widget_label_textshow.set_pos(324, 114)
screen_widget_label_textshow.set_size(134, 20)
screen_widget_label_textshow.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
# Set style for screen_widget_label_textshow, Part: lv.PART.MAIN, State: lv.STATE.DEFAULT.
screen_widget_label_textshow.set_style_border_width(0, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_label_textshow.set_style_radius(0, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_label_textshow.set_style_text_color(lv.color_hex(0xf66d1e), lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_label_textshow.set_style_text_font(test_font("simsun", 16), lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_label_textshow.set_style_text_letter_space(2, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_label_textshow.set_style_text_line_space(0, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_label_textshow.set_style_text_align(lv.TEXT_ALIGN.CENTER, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_label_textshow.set_style_bg_opa(0, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_label_textshow.set_style_pad_top(0, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_label_textshow.set_style_pad_right(0, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_label_textshow.set_style_pad_bottom(0, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_label_textshow.set_style_pad_left(0, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_label_textshow.set_style_shadow_width(0, lv.PART.MAIN|lv.STATE.DEFAULT)

# Create screen_widget_label_text
screen_widget_label_text = lv.label(screen_widget)
screen_widget_label_text.set_text("文本显示")
screen_widget_label_text.set_long_mode(lv.label.LONG.WRAP)
screen_widget_label_text.set_pos(234, 114)
screen_widget_label_text.set_size(80, 20)
screen_widget_label_text.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
# Set style for screen_widget_label_text, Part: lv.PART.MAIN, State: lv.STATE.DEFAULT.
screen_widget_label_text.set_style_border_width(0, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_label_text.set_style_radius(0, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_label_text.set_style_text_color(lv.color_hex(0xffffff), lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_label_text.set_style_text_font(test_font("simsun", 16), lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_label_text.set_style_text_letter_space(2, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_label_text.set_style_text_line_space(0, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_label_text.set_style_text_align(lv.TEXT_ALIGN.CENTER, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_label_text.set_style_bg_opa(0, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_label_text.set_style_pad_top(0, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_label_text.set_style_pad_right(0, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_label_text.set_style_pad_bottom(0, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_label_text.set_style_pad_left(0, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_label_text.set_style_shadow_width(0, lv.PART.MAIN|lv.STATE.DEFAULT)

# Create screen_widget_btn_return
screen_widget_btn_return = lv.btn(screen_widget)
screen_widget_btn_return_label = lv.label(screen_widget_btn_return)
screen_widget_btn_return_label.set_text("")
screen_widget_btn_return_label.set_long_mode(lv.label.LONG.WRAP)
screen_widget_btn_return_label.align(lv.ALIGN.CENTER, 0, 0)
screen_widget_btn_return.set_style_pad_all(0, lv.STATE.DEFAULT)
screen_widget_btn_return.set_pos(5, 4)
screen_widget_btn_return.set_size(63, 56)
screen_widget_btn_return.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
# Set style for screen_widget_btn_return, Part: lv.PART.MAIN, State: lv.STATE.DEFAULT.
screen_widget_btn_return.set_style_bg_opa(0, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_btn_return.set_style_border_width(0, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_btn_return.set_style_radius(5, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_btn_return.set_style_shadow_width(0, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_btn_return.set_style_text_color(lv.color_hex(0xffffff), lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_btn_return.set_style_text_font(test_font("simsun", 20), lv.PART.MAIN|lv.STATE.DEFAULT)
screen_widget_btn_return.set_style_text_align(lv.TEXT_ALIGN.CENTER, lv.PART.MAIN|lv.STATE.DEFAULT)

screen_widget.update_layout()
# Create screen_pinyin
screen_pinyin = lv.obj()
screen_pinyin.set_size(480, 320)
screen_pinyin.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
# Set style for screen_pinyin, Part: lv.PART.MAIN, State: lv.STATE.DEFAULT.
screen_pinyin.set_style_bg_opa(255, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_pinyin.set_style_bg_color(lv.color_hex(0x000000), lv.PART.MAIN|lv.STATE.DEFAULT)

# Create screen_pinyin_label_pinyin
screen_pinyin_label_pinyin = lv.label(screen_pinyin)
screen_pinyin_label_pinyin.set_text("键盘输入法")
screen_pinyin_label_pinyin.set_long_mode(lv.label.LONG.WRAP)
screen_pinyin_label_pinyin.set_pos(308, 11)
screen_pinyin_label_pinyin.set_size(158, 26)
screen_pinyin_label_pinyin.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
# Set style for screen_pinyin_label_pinyin, Part: lv.PART.MAIN, State: lv.STATE.DEFAULT.
screen_pinyin_label_pinyin.set_style_border_width(0, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_pinyin_label_pinyin.set_style_radius(0, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_pinyin_label_pinyin.set_style_text_color(lv.color_hex(0x3eff00), lv.PART.MAIN|lv.STATE.DEFAULT)
screen_pinyin_label_pinyin.set_style_text_font(test_font("simsun", 20), lv.PART.MAIN|lv.STATE.DEFAULT)
screen_pinyin_label_pinyin.set_style_text_letter_space(2, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_pinyin_label_pinyin.set_style_text_line_space(0, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_pinyin_label_pinyin.set_style_text_align(lv.TEXT_ALIGN.CENTER, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_pinyin_label_pinyin.set_style_bg_opa(255, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_pinyin_label_pinyin.set_style_bg_color(lv.color_hex(0xf6690c), lv.PART.MAIN|lv.STATE.DEFAULT)
screen_pinyin_label_pinyin.set_style_pad_top(0, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_pinyin_label_pinyin.set_style_pad_right(0, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_pinyin_label_pinyin.set_style_pad_bottom(0, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_pinyin_label_pinyin.set_style_pad_left(0, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_pinyin_label_pinyin.set_style_shadow_width(0, lv.PART.MAIN|lv.STATE.DEFAULT)

# Create screen_pinyin_imgbtn_1
screen_pinyin_imgbtn_1 = lv.imgbtn(screen_pinyin)
screen_pinyin_imgbtn_1.add_flag(lv.obj.FLAG.CHECKABLE)
screen_pinyin_imgbtn_1.set_src(lv.imgbtn.STATE.RELEASED, None, load_image(r"C:\NXP\GUI-Guider-Projects\CCM4101_GUI_160_1V0.2\CCM4101_GUI_160_1\CCM4101_GUI_160_1\generated\MicroPython\5_1_62_61.png"), None)
screen_pinyin_imgbtn_1.add_flag(lv.obj.FLAG.CHECKABLE)
screen_pinyin_imgbtn_1_label = lv.label(screen_pinyin_imgbtn_1)
screen_pinyin_imgbtn_1_label.set_text("")
screen_pinyin_imgbtn_1_label.set_long_mode(lv.label.LONG.WRAP)
screen_pinyin_imgbtn_1_label.align(lv.ALIGN.CENTER, 0, 0)
screen_pinyin_imgbtn_1.set_style_pad_all(0, lv.STATE.DEFAULT)
screen_pinyin_imgbtn_1.set_pos(0, 0)
screen_pinyin_imgbtn_1.set_size(62, 61)
screen_pinyin_imgbtn_1.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
# Set style for screen_pinyin_imgbtn_1, Part: lv.PART.MAIN, State: lv.STATE.DEFAULT.
screen_pinyin_imgbtn_1.set_style_img_opa(255, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_pinyin_imgbtn_1.set_style_text_color(lv.color_hex(0x000000), lv.PART.MAIN|lv.STATE.DEFAULT)
screen_pinyin_imgbtn_1.set_style_text_font(test_font("montserratMedium", 12), lv.PART.MAIN|lv.STATE.DEFAULT)
screen_pinyin_imgbtn_1.set_style_text_align(lv.TEXT_ALIGN.CENTER, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_pinyin_imgbtn_1.set_style_shadow_width(0, lv.PART.MAIN|lv.STATE.DEFAULT)
# Set style for screen_pinyin_imgbtn_1, Part: lv.PART.MAIN, State: lv.STATE.PRESSED.
screen_pinyin_imgbtn_1.set_style_img_opa(255, lv.PART.MAIN|lv.STATE.PRESSED)
screen_pinyin_imgbtn_1.set_style_text_color(lv.color_hex(0xFF33FF), lv.PART.MAIN|lv.STATE.PRESSED)
screen_pinyin_imgbtn_1.set_style_text_font(test_font("montserratMedium", 12), lv.PART.MAIN|lv.STATE.PRESSED)
screen_pinyin_imgbtn_1.set_style_shadow_width(0, lv.PART.MAIN|lv.STATE.PRESSED)
# Set style for screen_pinyin_imgbtn_1, Part: lv.PART.MAIN, State: lv.STATE.CHECKED.
screen_pinyin_imgbtn_1.set_style_img_opa(255, lv.PART.MAIN|lv.STATE.CHECKED)
screen_pinyin_imgbtn_1.set_style_text_color(lv.color_hex(0xFF33FF), lv.PART.MAIN|lv.STATE.CHECKED)
screen_pinyin_imgbtn_1.set_style_text_font(test_font("montserratMedium", 12), lv.PART.MAIN|lv.STATE.CHECKED)
screen_pinyin_imgbtn_1.set_style_shadow_width(0, lv.PART.MAIN|lv.STATE.CHECKED)

screen_pinyin.update_layout()
# Create screen_background
screen_background = lv.obj()
screen_background.set_size(480, 320)
screen_background.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
# Set style for screen_background, Part: lv.PART.MAIN, State: lv.STATE.DEFAULT.
screen_background.set_style_bg_opa(255, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_background.set_style_bg_color(lv.color_hex(0x323264), lv.PART.MAIN|lv.STATE.DEFAULT)

# Create screen_background_img_background_2
screen_background_img_background_2 = lv.img(screen_background)
screen_background_img_background_2.set_src(load_image(r"C:\NXP\GUI-Guider-Projects\CCM4101_GUI_160_1V0.2\CCM4101_GUI_160_1\CCM4101_GUI_160_1\generated\MicroPython\4_5_480_320.png"))
screen_background_img_background_2.add_flag(lv.obj.FLAG.CLICKABLE)
screen_background_img_background_2.set_pivot(50,50)
screen_background_img_background_2.set_angle(0)
screen_background_img_background_2.set_pos(0, 0)
screen_background_img_background_2.set_size(480, 320)
screen_background_img_background_2.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
# Set style for screen_background_img_background_2, Part: lv.PART.MAIN, State: lv.STATE.DEFAULT.
screen_background_img_background_2.set_style_img_opa(255, lv.PART.MAIN|lv.STATE.DEFAULT)

# Create screen_background_img_background_1
screen_background_img_background_1 = lv.img(screen_background)
screen_background_img_background_1.set_src(load_image(r"C:\NXP\GUI-Guider-Projects\CCM4101_GUI_160_1V0.2\CCM4101_GUI_160_1\CCM4101_GUI_160_1\generated\MicroPython\3_3_480_320.png"))
screen_background_img_background_1.add_flag(lv.obj.FLAG.CLICKABLE)
screen_background_img_background_1.set_pivot(50,50)
screen_background_img_background_1.set_angle(0)
screen_background_img_background_1.set_pos(0, 0)
screen_background_img_background_1.set_size(480, 320)
screen_background_img_background_1.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
# Set style for screen_background_img_background_1, Part: lv.PART.MAIN, State: lv.STATE.DEFAULT.
screen_background_img_background_1.set_style_img_opa(255, lv.PART.MAIN|lv.STATE.DEFAULT)

# Create screen_background_btn_imageswitch
screen_background_btn_imageswitch = lv.btn(screen_background)
screen_background_btn_imageswitch_label = lv.label(screen_background_btn_imageswitch)
screen_background_btn_imageswitch_label.set_text("")
screen_background_btn_imageswitch_label.set_long_mode(lv.label.LONG.WRAP)
screen_background_btn_imageswitch_label.align(lv.ALIGN.CENTER, 0, 0)
screen_background_btn_imageswitch.set_style_pad_all(0, lv.STATE.DEFAULT)
screen_background_btn_imageswitch.set_pos(416, 0)
screen_background_btn_imageswitch.set_size(64, 60)
screen_background_btn_imageswitch.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
# Set style for screen_background_btn_imageswitch, Part: lv.PART.MAIN, State: lv.STATE.DEFAULT.
screen_background_btn_imageswitch.set_style_bg_opa(0, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_background_btn_imageswitch.set_style_border_width(0, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_background_btn_imageswitch.set_style_radius(5, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_background_btn_imageswitch.set_style_shadow_width(0, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_background_btn_imageswitch.set_style_text_color(lv.color_hex(0xffffff), lv.PART.MAIN|lv.STATE.DEFAULT)
screen_background_btn_imageswitch.set_style_text_font(test_font("simsun", 16), lv.PART.MAIN|lv.STATE.DEFAULT)
screen_background_btn_imageswitch.set_style_text_align(lv.TEXT_ALIGN.CENTER, lv.PART.MAIN|lv.STATE.DEFAULT)

# Create screen_background_btn_back_return
screen_background_btn_back_return = lv.btn(screen_background)
screen_background_btn_back_return_label = lv.label(screen_background_btn_back_return)
screen_background_btn_back_return_label.set_text("")
screen_background_btn_back_return_label.set_long_mode(lv.label.LONG.WRAP)
screen_background_btn_back_return_label.align(lv.ALIGN.CENTER, 0, 0)
screen_background_btn_back_return.set_style_pad_all(0, lv.STATE.DEFAULT)
screen_background_btn_back_return.set_pos(0, 0)
screen_background_btn_back_return.set_size(64, 60)
screen_background_btn_back_return.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
# Set style for screen_background_btn_back_return, Part: lv.PART.MAIN, State: lv.STATE.DEFAULT.
screen_background_btn_back_return.set_style_bg_opa(0, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_background_btn_back_return.set_style_border_width(0, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_background_btn_back_return.set_style_radius(5, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_background_btn_back_return.set_style_shadow_width(0, lv.PART.MAIN|lv.STATE.DEFAULT)
screen_background_btn_back_return.set_style_text_color(lv.color_hex(0xffffff), lv.PART.MAIN|lv.STATE.DEFAULT)
screen_background_btn_back_return.set_style_text_font(test_font("montserratMedium", 16), lv.PART.MAIN|lv.STATE.DEFAULT)
screen_background_btn_back_return.set_style_text_align(lv.TEXT_ALIGN.CENTER, lv.PART.MAIN|lv.STATE.DEFAULT)

screen_background.update_layout()

def screen_content_btn_background_event_handler(e):
    code = e.get_code()
    if (code == lv.EVENT.RELEASED):
        lv.scr_load_anim(screen_background, lv.SCR_LOAD_ANIM.NONE, 0, 0, False)

screen_content_btn_background.add_event_cb(lambda e: screen_content_btn_background_event_handler(e), lv.EVENT.ALL, None)

def screen_content_btn_panel_event_handler(e):
    code = e.get_code()
    if (code == lv.EVENT.RELEASED):
        lv.scr_load_anim(screen_panel, lv.SCR_LOAD_ANIM.NONE, 0, 0, False)

screen_content_btn_panel.add_event_cb(lambda e: screen_content_btn_panel_event_handler(e), lv.EVENT.ALL, None)

def screen_content_btn_pinyin_event_handler(e):
    code = e.get_code()
    if (code == lv.EVENT.RELEASED):
        lv.scr_load_anim(screen_pinyin, lv.SCR_LOAD_ANIM.NONE, 0, 0, False)

screen_content_btn_pinyin.add_event_cb(lambda e: screen_content_btn_pinyin_event_handler(e), lv.EVENT.ALL, None)

def screen_content_btn_widget_event_handler(e):
    code = e.get_code()
    if (code == lv.EVENT.RELEASED):
        lv.scr_load_anim(screen_widget, lv.SCR_LOAD_ANIM.NONE, 0, 0, False)

screen_content_btn_widget.add_event_cb(lambda e: screen_content_btn_widget_event_handler(e), lv.EVENT.ALL, None)

def screen_panel_img_panel_event_handler(e):
    code = e.get_code()
    if (code == lv.EVENT.RELEASED):
        lv.scr_load_anim(screen_content, lv.SCR_LOAD_ANIM.NONE, 0, 0, False)

screen_panel_img_panel.add_event_cb(lambda e: screen_panel_img_panel_event_handler(e), lv.EVENT.ALL, None)

def screen_widget_btn_return_event_handler(e):
    code = e.get_code()
    if (code == lv.EVENT.RELEASED):
        lv.scr_load_anim(screen_content, lv.SCR_LOAD_ANIM.NONE, 0, 0, False)

screen_widget_btn_return.add_event_cb(lambda e: screen_widget_btn_return_event_handler(e), lv.EVENT.ALL, None)

def screen_pinyin_imgbtn_1_event_handler(e):
    code = e.get_code()
    if (code == lv.EVENT.RELEASED):
        lv.scr_load_anim(screen_content, lv.SCR_LOAD_ANIM.NONE, 0, 0, False)

screen_pinyin_imgbtn_1.add_event_cb(lambda e: screen_pinyin_imgbtn_1_event_handler(e), lv.EVENT.ALL, None)

def screen_background_btn_imageswitch_event_handler(e):
    code = e.get_code()
    if (code == lv.EVENT.RELEASED):
        screen_background_img_background_1.add_flag(lv.obj.FLAG.HIDDEN)
        screen_background_img_background_2.add_flag(lv.obj.FLAG.HIDDEN)

screen_background_btn_imageswitch.add_event_cb(lambda e: screen_background_btn_imageswitch_event_handler(e), lv.EVENT.ALL, None)

def screen_background_btn_back_return_event_handler(e):
    code = e.get_code()
    if (code == lv.EVENT.RELEASED):
        lv.scr_load_anim(screen_content, lv.SCR_LOAD_ANIM.NONE, 0, 0, False)

screen_background_btn_back_return.add_event_cb(lambda e: screen_background_btn_back_return_event_handler(e), lv.EVENT.ALL, None)

# content from custom.py

# Load the default screen
lv.scr_load(screen_content)

while SDL.check():
    time.sleep_ms(5)

